package game.network
{
	import engine.network.*;
	import game.messages.inventory.*;
	
	public class RxNetIDManager
	{
		private var m_map:Array;
		private var m_fetch:Vector.<int>;
		private static var s_instance:RxNetIDManager;
		
		public function RxNetIDManager()
		{
			this.m_map = new Array();
			this.m_fetch = new Vector.<int>;
			s_instance = this;
		}
		
		public static function get instance() : RxNetIDManager
		{
			return s_instance;
		}
		
		public function Get(key:int) : Object
		{
			if (key >= this.m_map.length)
			{
				return null;
			}
			return this.m_map[key];
		}
		
		public function Set(key:int, obj:Object) : void
		{
			if (key > 0)
			{
				this.m_map[key] = obj;
			}
		}
		
		public function Update(param1:RxNetMessageSocket) : void
		{
			/*
			var _loc_2:RxInventory_ItemRequest = null;
			var _loc_3:int = 0;
			if (param1 != null && param1.Connected())
			{
				_loc_2 = new RxInventory_ItemRequest();
				_loc_2.action = RxInventory_ItemRequest.ACTION_UPDATE;
				for each (_loc_3 in this.m_fetch)
				{
					
					_loc_2.id = _loc_3;
					param1.SendMessage(_loc_2);
				}
				this.m_fetch.length = 0;
			}
			*/
		}
		
		public function Fetch(param1:int) : void
		{
			var _loc_2:int = 0;
			if (param1 != 0)
			{
				if (this.Get(param1) == null)
				{
					_loc_2 = this.m_fetch.indexOf(param1);
					if (_loc_2 >= 0)
					{
						this.m_fetch.splice(_loc_2, 1);
						this.m_fetch.unshift(param1);
					}
					else
					{
						this.m_fetch.push(param1);
					}
				}
			}
		}
		
		public function Reset() : void
		{
			this.m_map.length = 0;
			this.m_fetch.length = 0;
		}
	}
}